# coding: utf-8
from time import sleep
import allure,json
from base.base_page import BasePage
from business.call.call_page import Call_Page
from common.logger import Logger

class Call_bs():
    def __init__(self,drivers_devices):

        drivers, devices, devices_info = drivers_devices
        self.d0 = BasePage(drivers[0])
        self.d1 = BasePage(drivers[1])
        self.device0=devices[0]
        self.device1 = devices[1]

    def call_technological(self,test_data):
        name_wx = test_data['name_wx']#''

        self.d0.click_elements(*Call_Page.SearchButton,doc='点击首页消息界面搜索按钮')
        self.d0.send_keys(*Call_Page.SearchBox,name_wx,doc='输入微信名称',inputType='send_keys',screenshot=2)

        Call_Page.SelectPersonnel[1]="微信号: %s"%name_wx #修改微信名，使用传进来的微信名
        self.d0.click_elements(*Call_Page.SelectPersonnel, doc='点击选择搜索的人员')
        self.d0.click_elements(*Call_Page.EnterCall, doc='点击右侧的加号+拉起操作菜单')
        self.d0.click_elements(*Call_Page.VideoCall, doc='点击视频通话拉起选择音频或视频通话')
        self.d0.click_elements(*Call_Page.VoiceCall, doc='点击语音通话,发起呼叫',screenshot=2)


        self.d1.click_elements(*Call_Page.Answer, doc='点击接听',screenshot=2)
        sleep(10)
        self.d1.click_elements(*Call_Page.hang_up, doc='点击挂断',screenshot=2)







